package com.ihr360.insurance.controller.benefit;

import com.ihr360.insurance.model.dto.benefits.MandatoryBenefitsMode;
import com.ihr360.insurance.service.MandatoryBenefitsModeService;
import com.ihr360.maven.plugin.ModuleCodeStore;
import com.ihr360.maven.plugin.annotation.FunctionDefinition;
import com.ihr360.maven.plugin.annotation.ModuleDefinition;
import com.ihr360.rest.service.SimpleRestService;
import com.ihr360.rest.webmvc.AbstractRestSimpleWithLongIdController;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Stone.Shi
 * @description 社保公积金法定福利政策
 * @date 2018-01-11 15:34:05.
 */
@RestController
@RequestMapping("/mandatoryBenefitsModes")
@ModuleDefinition(mainModuleCode = ModuleCodeStore.Module.BENEFIT_CODE_ADMIN,
        mainModuleName = ModuleCodeStore.Module.BENEFIT_NAME_ADMIN,
        subModuleCode = ModuleCodeStore.Module.BenefitAdmin.SI_HF_MODE_ADMIN_CODE,
        subModuleName = ModuleCodeStore.Module.BenefitAdmin.SI_HF_MODE_ADMIN_NAME,
        hasExtendsAbstractRestController = true)
public class MandatoryBenefitsModeController extends AbstractRestSimpleWithLongIdController<MandatoryBenefitsMode> {

    @Autowired
    private MandatoryBenefitsModeService benefitsModeService;

    @Override
    public SimpleRestService<MandatoryBenefitsMode, Long> getSimpleRestService() {
        return benefitsModeService;
    }

    @FunctionDefinition(functionName = "获取当前有效的法定福利政策", functionCode = ModuleCodeStore.Function.VIEW)
    @ApiOperation(value = "获取当前有效的法定福利政策")
    @GetMapping(value = "/getValidModes")
    public List<MandatoryBenefitsMode> getCurrentValidModes() {
        return benefitsModeService.getCurrentValidModes();
    }
}
